package Conversion

import scala.language.implicitConversions

case class IntWrapper(a: Int) extends AnyVal
case class DoubleWrapper(a: Double) extends AnyVal

def convert[T, U](x: T)(using converter: Conversion[T, U]): U = converter(x)

given IntWrapperToDoublueWrapper: Conversion[IntWrapper, DoubleWrapper] = new Conversion[IntWrapper, DoubleWrapper] {
  override def apply(i: IntWrapper): DoubleWrapper = DoubleWrapper(i.a)
}

def useConversion(using f: Conversion[IntWrapper, DoubleWrapper]) =
  val y: IntWrapper = IntWrapper(42)
  val x: DoubleWrapper = y
  x

def test: Unit =
  println(useConversion)
  println(convert(IntWrapper(42)))